<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>application</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	<br> 1.给application设置setAttribute参数count－＋＋i
	<br>
	<%!int i;%>
	<%
		application.setAttribute("count", String.valueOf(++i));
	%>
	<br> 2.通过application获得初始化参数－getInitParameter
	<br>
	<%
		String driver = application.getInitParameter("driver");
		String url = application.getInitParameter("url");
		String user = application.getInitParameter("name");
		String pass = application.getInitParameter("pass");

		out.println(driver+"<br>");
		out.println(url+"<br>");
		out.println(user+"<br>");
		out.println(pass+"<br>");
		
		out.println("另一种方法获取 getInitParameterNames 获取枚举"+"<br>");

		Enumeration<String> names = application.getInitParameterNames();
		while (names.hasMoreElements()) {
		    String name=names.nextElement();
			out.println(name+":"+application.getInitParameter(name)+"<br>");
		}
	%>
</body>
</html>
